<%--
  Created by IntelliJ IDEA.
  User: chenr
  Date: 7/17/2019
  Time: 9:44 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <title>航班信息</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <script type="text/javascript" src="/static/js/loader.js"></script>

</head>
<!-- 简化版的页面，可作为初步整合案例 -->
<body>
<div id="wrapper">
    <!--头部：页面标题栏-->
    <jsp:include page="../part/manager.header.jsp"></jsp:include>
    <!--导航栏：页面菜单栏-->
    <jsp:include page="../part/manager.menu.jsp"></jsp:include>
    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3>航班准点率预测</h3>
                        </div>
                        <div class="panel-body">
                            <div class="form-horizontal">
                                <div class="form-group" style="margin:10px">
                                    <label class="control-label col-sm-1" for="pre-temperature">温度:</label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" id="pre-temperature"/>
                                    </div>
                                    <label class="control-label col-sm-1" for="pre-model">机型:</label>
                                    <div class="col-sm-1">
                                        <select class="form-control" id="pre-model">
                                            <option>未知</option> <!-- 此处value="",后台才能拿到空串 -->
                                            <option>32D</option>
                                            <option>33L</option>
                                            <option>33W</option>
                                            <option>7M8</option>
                                            <option>A30B</option>
                                            <option>A319</option>
                                            <option>A320</option>
                                            <option>A321</option>
                                            <option>A325</option>
                                            <option>A330</option>
                                            <option>A332</option>
                                            <option>A333</option>
                                            <option>AN24</option>
                                            <option>B707</option>
                                            <option>B735</option>
                                            <option>B737</option>
                                            <option>B738</option>
                                            <option>B739</option>
                                            <option>B757</option>
                                            <option>B767</option>
                                            <option>B772</option>
                                            <option>B777</option>
                                            <option>B787</option>
                                            <option>CRJ</option>
                                            <option>CRJ9</option>
                                            <option>E190</option>
                                            <option>E195</option>
                                            <option>ERJ</option>
                                            <option>JET</option>
                                            <option>MA6</option>
                                        </select>
                                    </div>
                                    <label class="control-label col-sm-1" for="pre-cloud">天气状态:</label>
                                    <div class="col-sm-1">
                                        <select class="form-control" id="pre-cloud">
                                            <option>无</option> <!-- 此处value="",后台才能拿到空串 -->
                                            <option>尘</option>
                                            <option>沙</option>
                                            <option>霾</option>
                                            <option>轻雾</option>
                                            <option>雾</option>
                                            <option>雪</option>
                                            <option>雷暴</option>
                                        </select>
                                    </div>
                                    <label class="control-label col-sm-1" for="pre-visible">能见度:</label>
                                    <div class="col-sm-1">
                                        <select class="form-control" id="pre-visible">
                                            <option>低</option> <!-- 此处value="",后台才能拿到空串 -->
                                            <option>高</option>
                                        </select>
                                    </div>
                                    <div class="col-sm-2" style="text-align:center;">
                                        <button type="button" id="btn_query" class="btn btn-primary">
                                            <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 预 测
                                        </button>
                                    </div>
                                </div>
                                <div class="form-group" style="margin:25px">
                                    <div class="col-sm-2">
                                        <nobr>
                                            <label >预测准点率:</label>&nbsp&nbsp
                                            <label id="predict" >无</label>
                                        </nobr>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $("#btn_query").click(function(){
        var temperature = $("#pre-temperature").val();
        var flight=$("#pre-model").val();
        var cloud=$("#pre-cloud").val();
        var visible=$("#pre-visible").val();

        $.post("/admin/predict",{ temperature:temperature, flight:flight, cloud:cloud,visible:visible },function(data){
            if(data.State=="true"){
                alert("预测成功！")
                var label = document.getElementById("predict");
                label.innerHTML=data.predict;
            }
            else{
                alert("预测失败！");
            }
        })

    })
</script>

</body>
</html>
